# conding = utf-8
import time

from selenium.webdriver import ActionChains, Keys

from pages.page import Page

from pages.xgz.warehousing import  *


class AdminPagex(Page):
    '''
    系统管理->管理员UI操作
    '''
    # 查询UI测试
    def open_admin(self):
        '''
        打开管理员UI，如果已经打开则不会执行单击动作
        :return:
        '''
        if self.display(leftmenu)is False:
            self.click(leftmenu_sys)
        self.click(leftmenu)



    def search_input(self, value):
        '''
        输入查询数据，完成查询动作
        :param value:
        :return:
        '''
        self.send_keys(number, value)



    def search_btn(self):
        '''
        单击查找按钮
        :return:
        '''
        self.click(queryx)

    def reset_select(self):
        self.click(reset_select)

    #关闭
    def close_add(self):
        self.click(close_add)

    #关闭ESC
    def esc_add(self):
        self.click(esc_add)

    #主关闭
    def zhu_add(self):
        self.click(zhu_add)

    def cancel_toexamine(self):
        self.click(cancel_toexamine)


    # 第2个查询、、、、、、、、、、、、、、、、、、、、、、、、、
    def commod(self, value):
        '''
        输入查询数据，完成查询动作
        :param value:
        :return:
        '''
        self.send_keys(commoditys, value)

    #第3个输入框。。。。。。。。。。。。。。。。。。。。。。。。。。
    def timexe(self):
        self.click(timex)
    #开头日期
    def zhankaiese(self):
        self.click(zhankai)
    #结束日期
    def zhankaies(self):
        self.click(zhankaie)
    #往下--------------------------------------------------
    def wangxiaeq(self):
        self.click(wangxia)
    #第四个输入框--------------------------------------------
    # def add_wuliao_type(self):
    #     # 物料产品类型
    #     self.click(tieuj)  # 点击下拉框
    #     actions = ActionChains(self.driver)  # 定义动作链
    #     actions.send_keys(Keys.DOWN)  # 下键
    #     actions.send_keys(Keys.ENTER)  # 回车键
    #     actions.perform()


    def sear_result(self):
        '''
        单击查找完成后，获取查找结果
        :return:
        '''
        return self.text(resultx)


#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    def addeds(self):
        self.click(xingzhen)

    def add_wuliao_type(self):
        # 物料产品类型
        self.click(scommodity)  # 点击下拉框
        actions = ActionChains(self.driver)  # 定义动作链
        actions.send_keys(Keys.DOWN)  # 下键
        actions.send_keys(Keys.ENTER)  # 回车键
        actions.perform()

    def wenhaoa(self):
        self.click(wenhao)

    #衣服输入框
    def clotheses(self,value):
        self.send_keys(clothese, value)

    #正确的打勾
    def check_adde(self):
        self.click(check_adde)

    def resultss(self):
        self.click(buttent)

    #第2次查询
    def buttente(self):
        self.click(buttente)

    def resultsee(self):
        '''
        单击查找完成后，获取查找结果
        :return:
        '''
        return self.is_exists(nodata)
    #新增
    def addqerer(self):
        self.click(addqer)

    #再次点击新增
    def addqere(self):
        self.click(addqere)


    #消除提示框
    def elromptss(self):
        self.click(elrompts)

    #请输入名称
    def peasenames(self,value):
        self.send_keys(peasename, value)

    # 输入框请输入单位
    def pleaseunitw(self,value):
        self.send_keys(pleaseunit,value)
    #添加里面的确定
    def addconfirmations(self):
        self.click(addconfirmation)

    # 打勾
    def dagoe(self):
        self.click(dago)


    #再次输入确定
    def srkoniuq(self):
        self.click(input_rline)  # 点击输入框
        actions = ActionChains(self.driver)  # 定义动作链
        actions.send_keys(Keys.ENTER)  # 发送回车键
        actions.perform()  # 执行动作链

    #点击保存
    def click_ko_1q(self):
        self.click(click_ko)

    #点击确定
    def sure_wareho(self):
        self.click(sure_wareho)


    #打勾
    def dagoe(self):
        self.click(dago)

    #点击确定
    def addteine(self):
        self.click(addtein)

    def clicttosave_id(self):
        self.click(clicttosave)


    #添加的断言
    def assertion_add(self):
        return self.get_input_value(assertion_add)

    def information_add(self):
        return self.text(information_add)

    #刷新页面
    def windowsreset(self):
        self.driver.refresh()


    #点击完添加结果
    def resultssr(self):
        return self.is_exists(results)


    #点击查看
    def see_sernt_asd(self):
        self.click(see_sernt)
    #取消
    def cancel_qwe_asd(self):
        self.click(cancel_qwe_id)

    #判断详情是否出现
    def does_it_appear_id(self):
        return self.is_exists(does_it_appear)

    #选中
    def choice_sda(self):
        self.click(choice)
    #批量操作
    def batch_operation_asd(self):
        self.click(batch_operation)
    #反审核
    def anti_audit_asd(self):
        self.click(anti_audit)
    #确定
    def addtein_qwe_asd(self):
        self.click(addtein_qwe)
    #点击保存
    def click_ko_qwe(self):
        self.click(click_ko)
    #再次点击审核
    def again_ok_ieu(self):
        self.click(again_ok)
    #结果
    def confirm_operation_asd(self):
        return self.is_exists(confirm_operation)


    #编辑
    def edit_ioniu(self):
        self.click(edit_ion)

    #输入数量
    def quantity_ie(self,value):
        self.send_keys(quantityq,value)

    #保存
    def ok_qeew_qwe(self):
        self.click(ok_qeew)

    #保存你输入的值
    def save_the_results(self):
        return self.get_input_value(save_the_results)

    #结果
    def qweret_poi(self):
        return self.is_exists(qweret)
    #取消
    def quxi_toexamine(self):
        self.click(quxi_toexamine)

    #断言的结果
    def assert_editing(self):
        return self.text(assert_editing)




    #复制
    def fuz_qwe(self):
        self.click(fuz)

    # 插入行
    def insert_qewr(self):
        self.click(insert)

    # 放大镜
    def magnifier_qwe(self):
        self.click(magnifier)

    # 输入框
    def srkoniu(self, value):
        self.send_keys(srkone, value)

    #关闭
    def sdp_copy(self):
        self.click(sdp_copy)

    #点击查询
    def dinchi_pi(self):
        self.click(dinchi)

    # 打钩
    def hook_up_oiu(self):
        self.click(hook_up)

    # 单击确定
    def click_ok_uio(self):
        self.click(click_ok)
    #结果
    def fuzyj_qwe(self):
        return self.is_exists(fuzyj)

    #点击删除
    def delete_prompt_box_oi(self):
        self.click(delete_prompt_box)

    #点击删除
    def click_to_delete_qwe(self):
        self.click(click_to_delete)

    #删除的结果
    def delete_result_qwe(self):
        return self.is_exists(delete_result)
    #
    #
    # def Product_ymle_jg(self):
    #     '''
    #     单击查找完成后，获取查找结果
    #     :return:
    #     '''
    #     return self.text(Product_ymle)


    # # 添加管理员的UI测试
    # def insert_btn(self):
    #     self.click(insert_btn)
    #
    # def insert_input_username(self, value):
    #     self.send_keys(insert_username, value)
    #
    # def insert_input_password(self, value):
    #     self.send_keys(insert_password, value)
    #
    # def insert_sb_btn(self):
    #     self.click(insert_sb_btn)
    #
    # def insert_tips_text(self):
    #     '''
    #     获取断言的文本
    #     :return:
    #     '''
    #     return self.text(insert_tips)
    #
    # def insert_close_tips(self):
    #     '''
    #     关闭提示框
    #     :return:
    #     '''
    #     self.click(insert_close_tips)
    #
    # def insert_close_dialog(self):
    #     self.click(insert_close_dialog)
    #
    # def update_btn(self):
    #     self.click(update_btn)
    #
    # def update_input(self, value):
    #     self.send_keys(update_input, value)
    #
    # def update_password(self, value):
    #     self.send_keys(update_pass, value)
    #
    # def update_sb_btn(self):
    #     self.click(update_sb_btn)
    #
    # def update_tips_dian(self):
    #     return self.text(update_tips)
    #
    # def update_close_tips(self):
    #     self.click(update_close_tips)
    #
    # def update_close_dialog(self):
    #     self.click(update_close_dialog)
    #
    # def delete_clik(self):
    #     self.click(delete_clik)
    #
    # def get_delete_message(self):
    #     # 获取删除操作后的消息文本
    #     return self.text(delete_message_locator)